package com.nativelibs4java.buswing;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;
import javax.swing.tree.AbstractLayoutCache;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import javax.swing.UIManager;

import org.jdesktop.swingx.JXCollapsiblePane;
import org.jdesktop.swingx.JXTreeTable;
import org.jdesktop.swingx.treetable.TreeTableModel;
//import org.netbeans.swing.outline.DefaultOutlineModel;
//import org.netbeans.swing.outline.Outline;
//import org.netbeans.swing.outline.OutlineModel;
//import org.netbeans.swing.outline.TreePathSupport;

import com.nativelibs4java.buswing.AbstractMiningModel.DefaultColumnValue;
import com.nativelibs4java.buswing.AbstractMiningModel.DefaultMiningNode;
import java.awt.event.MouseAdapter;

public class OutlineTest {
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			if (!System.getProperty("os.name").contains("Mac"))
				for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
					if ("Nimbus".equals(info.getName())) {
						UIManager.setLookAndFeel(info.getClassName());
						break;
					}
				}
		} catch (Exception e) {
		}
		TableModel model = new DummyTableModel(
			new String[] { "Name", "Surname", "Gender", "Profession", "Age" },
			new Object[][] {
					{"John", "Allen", "Male", "Lawyier", "30" },
					{"John", "Allen", "Male", "Physician", "33" },
					{"Alexandra", "Smith", "Female", "Lawyier", "33" },
					{"John", "Smith", "Male", "Manual Worker", "24" },
					{"Patrick", "Smith", "Male", "Manual Worker", "30" },
					{"Patrick", "Smith", "Male", "Assistant", "19" },
					{"Patrick", "Allen", "Male", "Manual Worker", "26" },
					{"Paula", "Smith", "Female", "Assistant", "26" },
					{"Paula", "Allen", "Female", "Student", "25" }
			}
		);
		//new DefaultOutlineModel(DefaultOutlineModel(TreeModel treeModel, )
		final DefaultMiningModel mmodel = new DefaultMiningModel(model);
		
		
		final JMiningTable o = new JMiningTable(mmodel);
		JFrame f = new JFrame();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.getContentPane().add(o, "Center");
		
		Box b = Box.createHorizontalBox();
		JButton toggle = new JButton(o.groupPanel.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION));
		toggle.setText("Show/Hide Search Panel");
		b.add(toggle);
		f.getContentPane().add("South", b);
		 
		f.pack();
		f.setSize(800, 800);
		f.setVisible(true);
		//o.setModel(null)
	}
}
/*
class MiningOutlineModel extends DefaultOutlineModel {
	AbstractMiningModel miningModel;
	public MiningOutlineModel(AbstractMiningModel miningModel) {
		super(miningModel, miningModel, true, miningModel.getValueColumn().getName());
	}
}
*/
